<template>
    <div>
        <jsscom-heard />
        <div class="cons">
            <div class="pu-con pc-0">
                <p>当前位置：中国广告协会 > 商家</p>
            </div>
            <div class="pc-1 pu-con">
                <div class="pc-left">
                    <div class="dec">
                        <div class="dec-1" v-if="decData.adType==1">
                            <div class="dec-11">
                                <el-carousel height="240px" indicator-position="none">
                                    <el-carousel-item
                                        v-for="(item,index) in decData.img1.split(',')"
                                        :key="index"
                                    >
                                        <router-link to>
                                            <img :src="prefixUrl+item" alt />
                                            <p v-text="item.title"></p>
                                        </router-link>
                                    </el-carousel-item>
                                </el-carousel>
                            </div>
                            <div class="dec-12">
                                <p>
                                    <strong>公司名称：</strong>
                                    <strong>{{decData.company}}</strong>
                                </p>
                                <p>
                                    <strong>媒体类型：</strong>
                                    <strong>{{decData.mediaName}}</strong>
                                </p>
                                <p>
                                    <strong>所在地区：</strong>
                                    <strong>{{decData.area}}</strong>
                                </p>

                                <p>
                                    <strong>广告预算：¥</strong>
                                    <strong>{{decData.budget}}</strong>
                                    <strong>万元/月</strong>
                                </p>
                                <p>
                                    <strong>详细地址：</strong>
                                    <strong>{{decData.address}}</strong>
                                </p>
                                <p>
                                    <strong>广告咨询热线：</strong>
                                    <strong>{{decData.phone}}</strong>
                                </p>
                            </div>
                        </div>
                        <div class="dec-1" v-if="decData.adType==0">
                            <div class="dec-12">
                                <p>
                                    <strong>求购名称：</strong>
                                    <strong>{{decData.title}}</strong>
                                </p>
                                <p>
                                    <strong>媒体类型：</strong>
                                    <strong>{{decData.mediaName}}</strong>
                                </p>
                                <p>
                                    <strong>所在地区：</strong>
                                    <strong>{{decData.area}}</strong>
                                </p>

                                <p>
                                    <strong>广告预算：¥</strong>
                                    <strong>{{decData.budget}}</strong>
                                    <strong>万元/月</strong>
                                </p>
                                <p>
                                    <strong>联系人：</strong>
                                    <strong>{{decData.createUser}}</strong>
                                </p>
                                <p>
                                    <strong>联系电话：</strong>
                                    <strong>{{decData.phone}}</strong>
                                </p>
                            </div>
                        </div>
                        <div class="dec-2" v-if="decData.adType==0">
                            <span>
                                <h1>求购详情</h1>
                            </span>
                            <div>{{decData.brief}}</div>
                        </div>
                        <div class="dec-2" v-if="decData.adType==1">
                            <span>
                                <h1>资源详情</h1>
                            </span>
                            <div>{{decData.brief}}</div>
                        </div>
                        <div class="dec-2" v-if="decData.adType==1">
                            <span>
                                <h1>商家介绍</h1>
                            </span>
                            <div>{{decData.content}}</div>
                        </div>
                    </div>
                </div>
                <div class="pc-right">
                    <h1>商家推荐</h1>
                    <div class="pcr-con" v-if="sjtjList.length>0">
                        <router-link
                            :to="{path:'/gxzd/huwai/dec',query:{data:JSON.stringify(item) }}"
                            v-for="(item,index) in sjtjList.slice(0,3)"
                            :key="index"
                        >
                            <img :src="prefixUrl+item.img1.split(',')[0]" alt />
                            <h2>{{item.title}}</h2>
                            <p>{{item.area.match(/-(\S*)-(\S*)/)[1]}}/ {{item.mediaName}}</p>
                        </router-link>
                    </div>
                    <div class="pcr-con" v-else>
                        <p>暂无数据</p>
                    </div>
                </div>
            </div>
            <div style="height:25px"></div>
            <div class="pu-con pc-5">
                <router-link to>
                    <img src="../../../assets/g-10.png" alt />
                </router-link>
            </div>
        </div>
        <com-foot></com-foot>
    </div>
</template>

<script>
import jsscomHeard from '@/components/gxzd-heard'
import comFoot from '@/components/com-foot'

export default {
    components: {
        jsscomHeard,
        comFoot
    },
    filters: {
        pattime(value) {
            return value.slice(0, 10)
        }
    },
    data() {
        return {
            prefixUrl: '',
            decData: {},
            sjtjList: []
        }
    },
    created() {
        this.prefixUrl = this.$store.state.user.imgUrl
        this.decData = JSON.parse(this.$route.query.data)
        this.getToIndexListSj()
    },
    mounted() {

    },
    methods: {
        async getToIndexListSj() {
            const res = await this.$store.dispatch('access/getToIndexListSj')
            this.sjtjList = res
        },
        uncultivated() {
            this.$message({
                message: '功能暂未开放，敬请期待',
                type: 'warning'
            });
        },
    },
    watch: {
        $route: {
            handler: function (route) {
                this.decData = JSON.parse(this.$route.query.data)
            },
            immediate: true
        }
    },
}
</script>

<style scoped>
@import "./huwai-dec.css";
</style>
